package ynu.czs.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import ynu.czs.pojo.Result;
import ynu.czs.pojo.User;

/**
 * 用户服务 Feign 客户端
 */
@FeignClient(name = "user-service")
public interface UserFeignClient {

    /**
     * 获取用户信息
     */
    @GetMapping("/user/userInfo/{userId}")
    Result getUserInfo(@PathVariable("userId") Long userId);

    /**
     * 用户登录
     */
    @PostMapping("/user/login")
    Result login(@RequestBody User user);

    /**
     * 用户注册
     */
    @PostMapping("/user/register")
    Result register(@RequestBody User user);

    /**
     * 获取用户未支付订单
     */
    @GetMapping("/user/orderListNotPay/{userId}")
    Result getOrdersByUserIdNotPay(@PathVariable("userId") Long userId);

    /**
     * 获取用户已支付订单
     */
    @GetMapping("/user/orderListPay/{userId}")
    Result getOrdersByUserIdPay(@PathVariable("userId") Long userId);
}